package day14;

import java.util.Arrays;
import java.util.Scanner;

//幸运袋子
public class oj2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNext()) {
            int n = in.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
            }
            Arrays.sort(a);
            System.out.println(count(a, n, 0, 0, 1));
        }

    }
    public static int count(int[] a, int n, int pos, int sum, int multi) {
        int count = 0;
        for (int i = pos; i < n; i++) {
            sum += a[i];
            multi *= a[i];
            if (sum > multi) {
                count = count + 1 + count(a, n, i + 1, sum, multi);
            } else if (a[i] == 1) {
                count = count + count(a, n, i + 1, sum, multi);

            } else {
                break;
            }
            sum = sum - a[i];
            multi = multi / a[i];
            while (i < n - 1 && a[i] == a[i + 1]) {
                i++;
            }
        }
        return count;
    }
}
